package li.brauch.semesterarbeit.radio.impl;

import li.brauch.semesterarbeit.radio.RadioPlugin;

import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

public class LastFmPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {

	public LastFmPreferencePage() {
		super(GRID);
		IPreferenceStore store = RadioPlugin.getDefault().getPreferenceStore();
		setPreferenceStore(store);
		setDescription("last.fm radio settings:\n\n");
	}
	
	protected void createFieldEditors() {
		
		// username and password field editors
		addField(new StringFieldEditor("lastfmusername", "User name", 30, getFieldEditorParent()));
		addField(new StringFieldEditor("lastfmpassword", "Password", 30, getFieldEditorParent()));
		
		// Editor for bitrates
		String[][] bitrateList = new String[][] {{"64", "64"}, {"128", "128"}};		
		addField(new RadioGroupFieldEditor("lastfmbitrate", "Choose bitrate", 1, bitrateList, getFieldEditorParent(), true));
	}

	
	public void init(IWorkbench workbench) {
		// do nothing
	}
	
	
		
	public boolean performOk() {
		
		return super.performOk();
	}
	
}
